#include <iostream>
using namespace std;
class date {
public:


    int _Getdays(const int& y, const int& m) {

        static int arr[13] = { 1,31,28,31,30,31,30,31,31,30,31,30,31 };//

        if (m == 2 && (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) {//
            return 29;
        }

        return arr[m];
    }


    void operator+=(const int& n) {
        day += n;
        while (day > _Getdays(year, month)) {
            day -= _Getdays(year, month);
            if (month == 12) {
                month = 1;
                year++;
            }
            month++;
        }



    }



    //private:
    static int year;
    static int month;
    static int day;
    static int sum;
};
int date::year = 0;
int date::month = 0;
int date::day = 0;
int date::sum = 0;
int main() {
    date dt;

    cin >> dt.year >> dt.month >> dt.day >> dt.sum;
    dt += date::sum;

    cout << date::year << "-" << date::month << "-" << date::day;
}

